<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>PowerVR SDK</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<table width="100%">
  <tr>
    <td width="33%">
      <p align="left">&nbsp;<a href="http://www.imgtec.com"><img border="0" src="IMGLogo.jpg" width="200" height="30"></a></p>
    </td>
    <td width="33%">
      <p align="center"><font color="#808080" face="Arial" size="2">PowerVR Software Development Kit</a></font></p>
    </td>
    <td width="34%">
      <p align="right"><a href="http://www.powervr.com"><img border="0" src="PVRlogo.jpg" width="200" height="27"></a></p>
    </td>
  </tr>
</table>
<hr>
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>TimeController.h</h1><a href="TimeController_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/******************************************************************************</span>
00002 <span class="comment"></span>
00003 <span class="comment"> @File         TimeController.h</span>
00004 <span class="comment"></span>
00005 <span class="comment"> @Title        Time Controller</span>
00006 <span class="comment"></span>
00007 <span class="comment"> @Version      </span>
00008 <span class="comment"></span>
00009 <span class="comment"> @Copyright    Copyright (C)  Imagination Technologies Limited.</span>
00010 <span class="comment"></span>
00011 <span class="comment"> @Platform     Independent</span>
00012 <span class="comment"></span>
00013 <span class="comment"> @Description  Keeps track of time since last frame, direction of animation etc.</span>
00014 <span class="comment"></span>
00015 <span class="comment">******************************************************************************/</span>
00016 
00017 <span class="preprocessor">#ifndef TIMECONTROLLER_H</span>
00018 <span class="preprocessor"></span><span class="preprocessor">#define TIMECONTROLLER_H</span>
00019 <span class="preprocessor"></span>
00020 <span class="comment">/******************************************************************************</span>
00021 <span class="comment">Includes</span>
00022 <span class="comment">******************************************************************************/</span>
00023 <span class="preprocessor">#include "PVRTSingleton.h"</span>
00024 
00025 <span class="keyword">namespace </span>pvrengine
00026 {
00027     <span class="comment">/*!***************************************************************************</span>
00028 <span class="comment">    * @Class TimeController</span>
00029 <span class="comment">    * @Brief    Time Controller: Controller of Time.</span>
00030 <span class="comment">    * @Description  Time Controller: Controller of Time.</span>
00031 <span class="comment">    *****************************************************************************/</span>
00032     <span class="keyword">class </span>TimeController
00033     {
00034     <span class="keyword">public</span>:
00035         <span class="comment">/*!***************************************************************************</span>
00036 <span class="comment">        @Function           TimeController</span>
<a name="l00037"></a><a class="code" href="classpvrengine_1_1TimeController.html">00037</a> <span class="comment">        @Description        blank constructor.</span>
00038 <span class="comment">        *****************************************************************************/</span>
00039         <a class="code" href="classpvrengine_1_1TimeController.html#a0">TimeController</a>();
00040 
00041         <span class="comment">/*!***************************************************************************</span>
00042 <span class="comment">        @Function           setNumFrames</span>
00043 <span class="comment">        @Input              i32NumFrames    number of frames of animation</span>
00044 <span class="comment">        @Description        sets the number of frames for the animation to loop over</span>
00045 <span class="comment">        *****************************************************************************/</span>
00046         <span class="keywordtype">void</span>    <a class="code" href="classpvrengine_1_1TimeController.html#a1">setNumFrames</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> i32NumFrames)    {m_i32NumFrames = i32NumFrames;}
00047 
00048         <span class="comment">/*!***************************************************************************</span>
00049 <span class="comment">        @Function           setAnimationSpeed</span>
00050 <span class="comment">        @Input              fAnimationSpeed speed of animation multiplier</span>
00051 <span class="comment">        @Description        sets the speed of animation desired</span>
00052 <span class="comment">        *****************************************************************************/</span>
<a name="l00053"></a><a class="code" href="classpvrengine_1_1TimeController.html#a1">00053</a>         <span class="keywordtype">void</span>    <a class="code" href="classpvrengine_1_1TimeController.html#a2">setAnimationSpeed</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> fAnimationSpeed){ m_fAnimationSpeed = fAnimationSpeed;}
00054 
00055         <span class="comment">/*!***************************************************************************</span>
00056 <span class="comment">        @Function           getAnimationSpeed</span>
00057 <span class="comment">        @Return             the animation speed multiplier</span>
00058 <span class="comment">        @Description        Retrieve the animation speed value</span>
00059 <span class="comment">        *****************************************************************************/</span>
00060         <span class="keywordtype">float</span>       <a class="code" href="classpvrengine_1_1TimeController.html#a3">getAnimationSpeed</a>(){<span class="keywordflow">return</span> m_fAnimationSpeed;}
<a name="l00061"></a><a class="code" href="classpvrengine_1_1TimeController.html#a2">00061</a> 
00062         <span class="comment">/*!***************************************************************************</span>
00063 <span class="comment">        @Function           setFrame</span>
00064 <span class="comment">        @Input              fFrame  animation frame</span>
00065 <span class="comment">        @Description        sets the current frame for the animation</span>
00066 <span class="comment">        *****************************************************************************/</span>
00067         <span class="keywordtype">void</span>    <a class="code" href="classpvrengine_1_1TimeController.html#a4">setFrame</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> fFrame){   m_fFrame = fFrame;}
00068 
<a name="l00069"></a><a class="code" href="classpvrengine_1_1TimeController.html#a3">00069</a>         <span class="comment">/*!***************************************************************************</span>
00070 <span class="comment">        @Function           getFrame</span>
00071 <span class="comment">        @Input              iTime the current time</span>
00072 <span class="comment">        @Return             animation frame</span>
00073 <span class="comment">        @Description        retrieve the current frame for the animation</span>
00074 <span class="comment">        *****************************************************************************/</span>
00075         <span class="keywordtype">float</span>   <a class="code" href="classpvrengine_1_1TimeController.html#a5">getFrame</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> iTime);
00076 
<a name="l00077"></a><a class="code" href="classpvrengine_1_1TimeController.html#a4">00077</a>         <span class="comment">/*!***************************************************************************</span>
00078 <span class="comment">        @Function           getFPS</span>
00079 <span class="comment">        @Return             frames per second</span>
00080 <span class="comment">        @Description        retrieves the calculated frames per second value</span>
00081 <span class="comment">        *****************************************************************************/</span>
00082         <span class="keywordtype">float</span>   <a class="code" href="classpvrengine_1_1TimeController.html#a6">getFPS</a>()    {<span class="keywordflow">return</span> (<span class="keywordtype">float</span>)m_i32FPS;}
00083 
00084         <span class="comment">/*!***************************************************************************</span>
00085 <span class="comment">        @Function           getForwards</span>
00086 <span class="comment">        @Return             true forwards, false backwards</span>
00087 <span class="comment">        @Description        returns whether animation is set to go forwards or backwards</span>
00088 <span class="comment">        *****************************************************************************/</span>
00089         <span class="keywordtype">bool</span>    <a class="code" href="classpvrengine_1_1TimeController.html#a7">getForwards</a>(){<span class="keywordflow">return</span> m_bForwards;}
00090 
00091         <span class="comment">/*!***************************************************************************</span>
00092 <span class="comment">        @Function           setForwards</span>
00093 <span class="comment">        @Input              bForwards true forwards, false backwards</span>
<a name="l00094"></a><a class="code" href="classpvrengine_1_1TimeController.html#a6">00094</a> <span class="comment">        @Description        sets whether animation is to go forwards or backwards</span>
00095 <span class="comment">        *****************************************************************************/</span>
00096         <span class="keywordtype">void</span>    <a class="code" href="classpvrengine_1_1TimeController.html#a8">setForwards</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span> bForwards){m_bForwards = bForwards;}
00097 
00098         <span class="comment">/*!***************************************************************************</span>
00099 <span class="comment">        @Function           getDeltaTime</span>
00100 <span class="comment">        @Returns            delta time value</span>
00101 <span class="comment">        @Description        retrieve delta time value to allow frame independent</span>
<a name="l00102"></a><a class="code" href="classpvrengine_1_1TimeController.html#a7">00102</a> <span class="comment">        calculations</span>
00103 <span class="comment">        *****************************************************************************/</span>
00104         <span class="keywordtype">float</span>   <a class="code" href="classpvrengine_1_1TimeController.html#a9">getDeltaTime</a>(){<span class="keywordflow">return</span> m_fDeltaTime;}
00105 
00106         <span class="comment">/*!***************************************************************************</span>
00107 <span class="comment">        @Function           setFreezeTime</span>
00108 <span class="comment">        @Input              bFreeze true for pause, false to run</span>
00109 <span class="comment">        @Description        set whether the time controller should advance time or not</span>
<a name="l00110"></a><a class="code" href="classpvrengine_1_1TimeController.html#a8">00110</a> <span class="comment">        *****************************************************************************/</span>
00111         <span class="keywordtype">void</span>    <a class="code" href="classpvrengine_1_1TimeController.html#a10">setFreezeTime</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span> bFreeze){m_bFrozen = bFreeze;}
00112 
00113         <span class="comment">/*!***************************************************************************</span>
00114 <span class="comment">        @Function           start</span>
00115 <span class="comment">        @Input              iTime for start of demo - usually the current time from</span>
00116 <span class="comment">        the PVRShell</span>
00117 <span class="comment">        @Description        starts the timecontroller handling time; mandatory</span>
00118 <span class="comment">        *****************************************************************************/</span>
<a name="l00119"></a><a class="code" href="classpvrengine_1_1TimeController.html#a9">00119</a>         <span class="keywordtype">void</span>    <a class="code" href="classpvrengine_1_1TimeController.html#a11">start</a>(<span class="keywordtype">int</span> iTime){m_iTimePrev = iTime;}
00120 
00121         <span class="comment">/*!***************************************************************************</span>
00122 <span class="comment">        @Function           rewind</span>
00123 <span class="comment">        @Description        rewinds the frame number for the current animation at a</span>
00124 <span class="comment">        higher than normal rate</span>
00125 <span class="comment">        *****************************************************************************/</span>
00126         <span class="keywordtype">void</span> <a class="code" href="classpvrengine_1_1TimeController.html#a12">rewind</a>();
<a name="l00127"></a><a class="code" href="classpvrengine_1_1TimeController.html#a10">00127</a> 
00128         <span class="comment">/*!***************************************************************************</span>
00129 <span class="comment">        @Function           fastforward</span>
00130 <span class="comment">        @Description        fastforwards the frame number for the current animation at a</span>
00131 <span class="comment">        higher than normal rate</span>
00132 <span class="comment">        *****************************************************************************/</span>
00133         <span class="keywordtype">void</span> <a class="code" href="classpvrengine_1_1TimeController.html#a13">fastforward</a>();
00134 
00135     <span class="keyword">private</span>:
00137         <span class="keywordtype">int</span>             m_iTimePrev;    
00138         <span class="keywordtype">float</span>           m_fFrame, m_fDeltaTime, m_fAnimationSpeed;  
00139         <span class="keywordtype">int</span>             m_i32FrameCount, m_i32DeltaTimeTotal, m_i32FPS; 
00140         <span class="keywordtype">int</span>             m_i32NumFrames ;    
00141         <span class="keywordtype">bool</span>            m_bFrozen, m_bForwards; 
00143     };
00144 }
00145 <span class="preprocessor">#endif // TIMECONTROLLER_H</span>
00146 <span class="preprocessor"></span>
00147 <span class="comment">/******************************************************************************</span>
00148 <span class="comment">End of file (TimeController.h)</span>
00149 <span class="comment">******************************************************************************/</span>
00150 
</pre></div><br>
<br>
<P align=left><FONT size=2><STRONG><A 
   href="http://www.imgtec.com/powervr/insider/legal/index.asp">Copyright</A> � 
   1999-2008, Imagination Technologies Ltd.</STRONG></FONT></P>
<hr>
<address style="align: left;"><small><FONT color=f0f>
Generated by <a href="http://www.doxygen.org/index.html">DOXYGEN</a> 1.3.6</small></address>
</body>
</html>
